﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace chess
{
    public class csPossibleMove
    {

        private csFig _fig = null;
        private csField _dest = null;
        private int _value = 0;
        
        public csPossibleMove(csFig fig, csField dest)
        {
            this._fig = fig;
            this._dest = dest;

            this._value = this._dest.Value;

            // Wird das Feld bedroht, muss das mögliche Opfer in Betracht gezogen werden
            // Daher wird der Wert der derzeit kalkulierten Figur vom Wert des Zielfeldes abgezogen
            if (this._dest.Offended == true)
            {
                this._value -= this._fig.Value;
            }
        }
        
        public override string ToString()
        {
            return this._fig.Party.ToString() + this._fig.FigType.ToString() + Convert.ToString(this._fig.Spalte) + Convert.ToString(this._fig.Zeile) + Convert.ToString(this._dest.Spalte) + Convert.ToString(this._dest.Zeile);
        }

        public int Evaluation
        {
            get { return this._value; }
        }

        public csFig Fig
        {
            get { return this._fig; }
        }

        public csField Field
        {
            get { return this._dest; }
        }
    }
}
